import request from "@/utils/request";

export function login(data) {
  return request({
    url: "/api/users/login",
    method: "post",
    data,
  });
}

export function fetchUserList(params) {
  return request({
    url: "/api/users/page",
    method: "get",
    params,
  });
}

export function createUser(data) {
  return request({
    url: "/api/users/register",
    method: "post",
    data,
  });
}

export function updateUser(id, data) {
  return request({
    url: `/api/users/${id}`,
    method: "put",
    data,
  });
}

export function deleteUser(id) {
  return request({
    url: `/api/users/${id}`,
    method: "delete",
  });
}
